import { createApp } from "vue";
import "./style/index.css";
import App from "./App.vue";
import router from "./routes/index";
import { createPinia } from "pinia";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import { useUserStore } from "./stores/user";
// import { getUrlParam } from "./utils/utils";
// import { cookie } from "./utils/cookie";
const pinia = createPinia();

const app = createApp(App);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
app.use(router);
app.use(pinia);

// 本地测试用
// let token = getUrlParam("token");
// console.log("main token", token);
// if (token) {
//   sessionStorage.setItem("token", token);
//   cookie.set("AUTHORIZATION", token);
//   // window.location.href = GLOBAL.WEB_HOME;
// }
const userStore = useUserStore();
userStore.getUserInfo();
app.use(ElementPlus);
app.mount("#app");
